import java.util.Scanner;
/**
 * Created with Intellij IDEA.
 * Description;
 * User:墨琦
 * Data:2023-03-07
 * Time:15:02
 */
public class Occupation extends Hero {
    private String profession;
    Occupation(String name,double blood,double comat,String profession)
    {
        super(name, blood, comat);
        this.profession=profession;
    }
    public String attack() {
        System.out.println("选择攻击：\n1.射手or2.战士");
        Scanner scan = new Scanner(System.in);
        double bood = 500;
        double boods=1200;
        int a = scan.nextInt();
        while (true) {
            if (a == 1) {
                bood -= comat;
                System.out.println("攻击成功，敌人还剩" + bood + "血量，你即将接到攻击");
                System.out.println("你是否选择躲闪？");
                System.out.println("1.是  2.否");
                int c = scan.nextInt();
                if (c == 1) {
                    System.out.println("叫我大哥，大哥带你躲");
                    String fw = scan.next();
                    if (fw.equals("大哥")) {
                        System.out.println("成功跑了哦\n目前血量：" + blood);
                    } else {
                        System.out.println("那祝你好运");
                        int num = (int) (Math.random() * 100);
                        int n = (int) (Math.random() * 60 + 30);
                        if (num < 20) {
                            System.out.println("你运气很好，成功跑路");
                        } else {
                            blood -= n;
                            System.out.println("哦不，受到伤害了！！！\n目前血量" + blood+"\n----------------");
                        }
                    }
                } else {
                    int n = (int) (Math.random() * 60 + 30);
                    blood -= n;
                    System.out.println("哦不，受到伤害了！！！\n目前血量" + blood+"\n----------------");
                }

            }
            else{
                boods -= comat;
                System.out.println("攻击成功，敌人还剩" + boods + "血量，你即将接到攻击");
                System.out.println("你是否选择躲闪？");
                System.out.println("1.是  2.否");
                int c = scan.nextInt();
                if (c == 1) {
                    System.out.println("叫我大哥，大哥带你躲");
                    String fw = scan.next();
                    if (fw.equals("大哥")) {
                        System.out.println("成功跑了哦\n目前血量：" + blood);
                    } else {
                        System.out.println("那祝你好运");
                        int num = (int) (Math.random() * 100);
                        int n = (int) (Math.random() * 40 + 30);
                        if (num < 20) {
                            System.out.println("你运气很好，成功跑路");
                        } else {
                            blood -= n;
                            System.out.println("哦不，受到伤害了！！！\n目前血量:" + blood);
                        }
                    }
                } else {
                    int n = (int) (Math.random() * 40 + 30);
                    blood -= n;
                    System.out.println("哦不，受到伤害了！！！\n目前血量:" + blood);
                }

            }
            if (boods < 0 || bood<0)

            {
                return "我们胜利";
            }
            else if(blood < 0)
            {
                return "敌人胜利了";
            }
        }
    }
}
class tank extends Occupation{
    tank(String name) {
        super(name,1200,50,"坦克");
    }
}
class shooter extends Occupation{

    shooter(String name) {
        super(name, 500, 60,"坦克");
    }
}